<template>
  <!-- 修改界面 -->
  <div>
    <el-form ref="form" :model="userData" label-width="110px">
      <el-form-item label="统一认证Id:">
        <el-input v-model="userData.authId" disabled="disabled" />
      </el-form-item>
      <el-form-item label="手机号:">
        <el-input v-model="userData.phone" />
      </el-form-item>
      <el-form-item label="身份证号:">
        <el-input v-model="userData.idCardNo" />
      </el-form-item>

      <el-form-item label="身份验证状态:">
        <div>

          <el-radio v-model="userData.idCardNoVerify" :label="Boolean(true)" border>已审核</el-radio>
          <el-radio v-model="userData.idCardNoVerify" :label="Boolean(false)" border>未审核</el-radio>
        </div>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">编辑</el-button>
        <router-link :to="'/user/index'">
          <el-button>取消</el-button>
        </router-link>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import user from '@/api/user/user'
export default {
  data() {
    return {
      userData: {}
    }
  },
  created() {
    if (this.$route.params && this.$route.params.id) {
      this.getDataById(this.$route.params.id)
    }
  },
  methods: {
    onSubmit() {
      user.updateUser(this.userData).then(data => {
        this.$message({
          type: data.flag == true ? 'success' : 'error',
          message: data.message,
          showClose: true
        })
        this.$router.push({ path: '/user/index' })
      }).catch(e => {

      })
    },
    getDataById(id) {
      user
        .getDataById(id)
        .then((data) => {
          this.userData = data.data
        })
        .catch((e) => {

        })
    }
  }
}
</script>

<style>
</style>
